<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        function fun(){
            console.log('函数方法');
        }
        try{
            var fun = 10;
            fun();

        }catch (e){
            console.log(e);
            
        }
        console.log('程序没问题');
        

        try {
            function fun2 (name) {
                if(name == ondefined){
                    throw{errMag:'未传入参数',code:10003};
                }
            console.log(name);
            }
            fun2();
        }catch (e) {
            console.log(e.errMag);
            
        }finally {

        }
        console.log('fun2 执行之后');
        
    </script>
</body>
</html>